Function: rootpath

CALL:

fname=rootpath(fname)

DESCRIPTION:

Expand filename with path of (read only) directory that holds compiled matlab executable (in deployed mode), or invariant (in non deployed mode). This function is intended to allow running a compiled application while "pwd" is unequal to fileparts(applic.exe). Usually exeroot will be read only.

INPUT:

      fname: file specified without a path

OUPUT any
fname
    If not deployed mode or fname was specified with path: input.fname
    Otherwise: fname =fullfile(exeroot,input.fname)

EXAMPLE:

      Non deployed mode:
      load(rootpath('kuststrook.kst')) ==> load kuststrook.kst from current
      directory or matlab path: 
          rootpath('kuststrook.kst')='kuststrook.kst'
  
      Compiled mode:
      load(rootpath('kuststrook.kst')) ==> load kuststrook from directory
      that holds exefile:  
          rootpath('kuststrook.kst')=fullfile(exeroot,'kuststrook.kst') 
      This holds regardless of pwd, and thus allows starting the compiled
      application from another directory (for example: cd /mydir,
      /matlabdir/applic.exe). At the clients computer, the directory that
      holds the executable is ofter read-only, while applications many
      applications need to write files to pwd.
  
  NOTE
      This function is designed to extend filenames with the path of an exe
      file for compiled Matlab applications. The function only effects
      filenames that are specified without a path name. To construct more
      complex relative path names (for example ROOT/data/mydata.txt), use
      the function "exeroot".